from pathlib import Path


def read_file(filename):
    filepath = Path(__file__).parent / filename
    try:
        with open(filepath, "r", encoding="utf-8") as f:
            for row_index, content in enumerate(f):
                print(f"{row_index+1}:{content}")
    except Exception as e:
        print("异常为=", e)


read_file("example.txt")
